<include file="public@meta" />
<body class="layui-layout-body">
<div id="LAY_app">
	<div class="layui-layout layui-layout-admin">
		<!-- 头部区域 -->
		<include file="public@header" />

		<!-- 侧边菜单 -->
		<include file="public@side" />

		<!-- 页面标签 -->
		<include file="public@tabs" />

		<!-- 主体内容 -->
		<include file="public@content" />

		<!-- 辅助元素，一般用于移动设备下遮罩 -->
		<div class="layadmin-body-shade" layadmin-event="shade"></div>
	</div>
</div>
<script>
	layui.config({
		base: '__STATIC__/layuiadmin/' //静态资源所在路径
	}).extend({
		index: 'lib/index' //主入口模块
	}).use(['index','layer','form'],function(){
		var $ = layui.$,
				form = layui.form,
				layer = layui.layer;

		//退出登录
		$("#logout").click(function(obj){
			console.log('退出');
			$.ajax({
				type: "POST",
				url: "{:url('Login/logout')}",
				data: obj.field,
				dataType: "json",
				success: function(res){
					layui.data('center_cache_data', null); //清空数据
					layer.msg(res.message,{icon:1,time:1500},function()
					{
						window.location.href = "{:url('Login/login')}";
					});
				}
			});
		});

		//清理缓存
		$("#clear_cache").click(function(obj){
			$.ajax({
				type: "POST",
				url: "{:url('clearCache')}",
				dataType: 'json',
				data: { type: $(this).data("type") },
				cache: false,
				success: function(res) {
					if (res.code == 1) {
						var index = layer.msg('清除缓存中，请稍候', { icon: 16, time: false, shade: 0.8 });
						setTimeout(function() {
							layer.close(index);
							layer.msg("缓存清除成功！");
						}, 1000);
					}else{
						layer.msg('清除缓存失败');
					}
				},
				error: function() {
					layer.msg('清除缓存失败');
				}
			});
		});
	});

</script>

</body>
</html>